package com.atguigu.java.ai.langchain4j.tools;

import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import dev.langchain4j.agent.tool.ToolMemoryId;
import org.springframework.stereotype.Component;

@Component
public class CalculatorTools {
    @Tool(name = "加法工具",value =  "当两个数相加时调用此方法，实行相加")
    public int add(@ToolMemoryId int memoryId, @P(value = "加数2",required = true)int a, @P(value = "加数1",required = true)int b) {
        System.out.println("执行了加法");
        return a + b;
    }
    @Tool(name = "减法工具",value =  "当两个数相减时调用此方法，实行相减")
    public int subtract(  @ToolMemoryId int memoryId, @P(value = "减数1",required = true)int a, @P(value = "减数2",required = true)int b) {
        System.out.println("执行了减法");
        return a - b;
    }
}
